home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 41
/
Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso
/
Aminet
/
gfx
/
fract
/
FlashMandel.lha
/
Sources
/
Modules
/
Julia.S
< prev
next >
Wrap
Text File
|
2000-09-17
|
7KB
|
102 lines
***********************************************************************************************
** Written by Dino Papararo 08-Sep-2000 *
** *
** FUNCTION *
** *
** Julia -- perform Z = Z^2 + C iteration. *
** *
** SYNOPSIS *
** *
** WORD Julia68k_FPU (WORD Iterations,long double Cre,long double Cim) *
** *
** *
** DESCRIPTION *
** *
** C equivalent function: *
** *
** ***************************************************************************************
** *WORD Julia (WORD Iterazioni,double Cre,double Cim,const double Jim,cont double Jre)***
** *{ ***
** *register long double zr,zi,zi2,dist,maxdist; ***
** * ***
** * zi = Cim; ***
** * ***
** * zr = Cre; ***
** * ***
** * maxdist = 4; ***
** * ***
** * do { ***
** * zi2 = zi; ***
** * ***
** * zi *= zr; ***
** * ***
** * zr *= zr; ***
** * ***
** * zi2 *= zi2; ***
** * ***
** * dist = zr; ***
** * ***
** * dist += zi2; ***
** * ***
** * if (dist > maxdist) return Iterazioni; ***
** * ***
** * zi += zi; ***
** * ***
** * zr -= zi2; ***
** * ***
** * zi += Jim; ***
** * ***
** * zr += Jre; ***
** * ***
** * } while (-- Iterazioni); ***
** * ***
** * return 0; ***
** *} ***
** ***************************************************************************************
** *
** This function tests if a point belongs or not at Julia set *
** *
** Optimized for pipelines of 68882+ coprocessors *
** *
** NOTICE: ALL VARIABLES ARE INTO REGISTERS FOR FULL SPEEEED *
** *
** d0:Iterations *
** *
** fp0:Cre/Jre fp1:Cim/Jim fp2:Zr fp3:Zi fp4:Zi2 fp5:Dist fp6:Tmp/MaxDist fp7:Tmp *
***********************************************************************************************
* MACHINE 68060
XDEF _Julia68k_FPU
_Julia68k_FPU:
fmove.x fp0,fp2 * Zr = Cre
fmove.x fp1,fp3 * Zi = Cim
fmove.x fp6,fp0 * Moving Julia real constant to fp0
fmove.x fp7,fp1 * Moving Julia imag constant to fp1
fmove.x #4,fp6 * MaxDist = 4
Loop:
fmove.x fp3,fp4 * zi2 = zi
fmul.x fp2,fp3 * zi = zr * zi
fmul.x fp2,fp2 * zr = zr * zr
fmul.x fp4,fp4 * zi2 *= zi
fmove.x fp2,fp5 * dist = zr
fadd.x fp4,fp5 * dist += zi2
fcmp.x fp6,fp5 * cmp MaxDist dist
fbgt.w Exit * if dist > MaxDist exit
fadd.x fp3,fp3 * zi += zi
fsub.x fp4,fp2 * zr -= zi2
fadd.x fp1,fp3 * zi += Jim
fadd.x fp0,fp2 * zr += Jre
dbra.w d0,Loop * if --Iterations go to Loop
moveq.l #0,d0 * Iterations = 0
Exit:
rts * return Iterations
end